import { ref, reactive, onMounted, unref, watch, computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { storeToRefs } from 'pinia'
import useAppStore from '@/stores/app'

export function useClaimColumns() {
  const { t } = useI18n()
  const appStore = useAppStore()

  const { language } = storeToRefs(appStore)

  const dynamicClaimInfoColumns = computed(() => {
    return [
      { title: t('home.claim.ClaimNo'), width: 120, dataIndex: 'claimNo', key: 'claimNo' },
      {
        title: t('home.claim.PatientName'),
        width: 160,
        dataIndex: 'membersName',
        key: 'membersName'
      },
      {
        title: t('home.claim.HospitalName'),
        dataIndex: 'providerName',
        key: 'providerName',
        width: 240
      },
      {
        title: t('home.claim.ServiceDate'),
        dataIndex: 'serviceDate',
        key: 'serviceDate',
        width: 180
      },
      {
        title: t('home.claim.ClaimStatus'),
        dataIndex: 'claimStatus',
        key: 'claimStatus',
        width: 140
      },
      {
        title: t('home.claim.SubtaskStatus'),
        dataIndex: 'subTaskStatus',
        key: 'subTaskStatus',
        width: 140
      },
      {
        title: t('home.claim.ReceiveDate'),
        dataIndex: 'claimReceivedDate',
        key: 'claimReceivedDate',
        width: 140
      },
      {
        title: t('home.claim.MissingDocs'),
        dataIndex: 'isIncompleteNowCodeDesc',
        key: 'isIncompleteNowCodeDesc',
        width: 140
      },
      {
        title: t('home.claim.OriginalPrice'),
        dataIndex: 'claimOriginalPrice',
        key: 'claimOriginalPrice',
        width: 140
      },
      {
        title: t('home.claim.DiscountPrice'),
        dataIndex: 'discountPrice',
        key: 'discountPrice',
        width: 140
      },
      {
        title: t('home.claim.TotalNonCompensable'),
        dataIndex: 'noCompensationSummaryAmount',
        key: 'noCompensationSummaryAmount',
        width: language.value == 'zh' ? 160 : 200
      },
      {
        title: t('home.claim.Payable'),
        dataIndex: 'calculateCompensationAmount',
        key: 'calculateCompensationAmount',
        width: language.value == 'zh' ? 220 : 260
      },
      {
        title: t('home.claim.PaidAmount'),
        dataIndex: 'actualCompensationAmount',
        key: 'actualCompensationAmount',
        width: 140
      },
      {
        title: t('home.claim.RejectionExplanation'),
        dataIndex: 'nopayReasonAndConclusion',
        key: 'nopayReasonAndConclusion',
        width: 300
      },
      { title: t('home.claim.PaidStatus'), dataIndex: 'paidStatus', key: 'paidStatus', width: 140 },
      {
        title: t('home.claim.OBRemaining'),
        dataIndex: 'restOBAmount',
        key: 'restOBAmount',
        width: 140
      },
      {
        title: t('home.claim.RelatedClaimStatus'),
        dataIndex: 'appealStatus',
        key: 'appealStatus',
        width: language.value == 'zh' ? 140 : 200
      },
      { title: t('home.claim.ClaimType'), dataIndex: 'claimType', key: 'claimType', width: 140 },
      {
        title: t('home.claim.BatchNo'),
        dataIndex: 'claimBatchNumber',
        key: 'claimBatchNumber',
        width: 140
      }
    ]
  })
  const dynamicInnerColumns = computed(() => {
    return [
      { title: t('home.claim.ClaimNo'), width: 120, dataIndex: 'claimNo', key: 'claimNo' },
      {
        title: t('home.claim.ClaimStatus'),
        dataIndex: 'claimStatus',
        key: 'claimStatus',
        width: 140
      },
      {
        title: t('home.claim.SubtaskStatus'),
        dataIndex: 'subTaskStatus',
        key: 'subTaskStatus',
        width: 140
      },
      {
        title: t('home.claim.ReceiveDate'),
        dataIndex: 'claimReceivedDate',
        key: 'claimReceivedDate',
        width: 140
      },
      {
        title: t('home.claim.MissingDocs'),
        dataIndex: 'isIncompleteNowCodeDesc',
        key: 'isIncompleteNowCodeDesc',
        width: 140
      },
      {
        title: t('home.claim.OriginalPrice'),
        dataIndex: 'claimOriginalPrice',
        key: 'claimOriginalPrice',
        width: 140
      },
      {
        title: t('home.claim.DiscountPrice'),
        dataIndex: 'discountPrice',
        key: 'discountPrice',
        width: 140
      },
      {
        title: t('home.claim.TotalNonCompensable'),
        dataIndex: 'noCompensationSummaryAmount',
        key: 'noCompensationSummaryAmount',
        width: language.value == 'zh' ? 160 : 200
      },
      {
        title: t('home.claim.Payable'),
        dataIndex: 'calculateCompensationAmount',
        key: 'calculateCompensationAmount',
        width: language.value == 'zh' ? 220 : 260
      },
      {
        title: t('home.claim.PaidAmount'),
        dataIndex: 'actualCompensationAmount',
        key: 'actualCompensationAmount',
        width: 140
      },
      {
        title: t('home.claim.RejectionExplanation'),
        dataIndex: 'nopayReasonAndConclusion',
        key: 'nopayReasonAndConclusion',
        width: 300
      },
      { title: t('home.claim.PaidStatus'), dataIndex: 'paidStatus', key: 'paidStatus', width: 140 },
      {
        title: t('home.claim.OBRemaining'),
        dataIndex: 'restOBAmount',
        key: 'restOBAmount',
        width: 140
      },
      { title: t('home.claim.ClaimType'), dataIndex: 'claimType', key: 'claimType', width: 140 },
      {
        title: t('home.claim.BatchNo'),
        dataIndex: 'claimBatchNumber',
        key: 'claimBatchNumber',
        width: 140
      }
    ]
  })
  return { dynamicClaimInfoColumns, dynamicInnerColumns }
}
